using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class achievement_criteria_requirement : MangosBase
	{
		public System.Int32? criteria_id;
		public System.Byte? type;
		public System.UInt32? value1;
		public System.UInt32? value2;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `achievement_criteria_requirement` (`criteria_id`, `type`, `value1`, `value2`) VALUES ('{0}', '{1}', '{2}', '{3}');", criteria_id.GetValueOrDefault(), type.GetValueOrDefault(), value1.GetValueOrDefault(), value2.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `achievement_criteria_requirement` SET ");
			if(type != null)
			{
				sb.AppendLine("`type`='" + type.Value.ToString() + "'");
			}
			if(value1 != null)
			{
				sb.AppendLine("`value1`='" + value1.Value.ToString() + "'");
			}
			if(value2 != null)
			{
				sb.AppendLine("`value2`='" + value2.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `criteria_id`='" + criteria_id.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
